<?php
	$bt=isset($_REQUEST["submit"])?$_REQUEST["submit"]:"";
	if($bt!="")
	{
	$email=$_SESSION["email"];
	$hoten=isset($_POST["hoten"])?$_POST["hoten"]:"";
	$diachi=isset($_POST["diachi"])?$_POST["diachi"]:"";
	//$email=isset($_POST["email"])?$_POST["email"]:"";
	$dienthoai=isset($_POST["dienthoai"])?$_POST["dienthoai"]:"";
	$dt=isset($_POST["dt"])?$_POST["dt"]:"";
	if($hoten!="" and $dienthoai!="" and $dt!="" and $diachi!="")
	{	
		$sql="update khachhang set tenkh='$hoten',sdtban='$dienthoai',sdtdd='$dt',diachi='$diachi' where email='$email'";
		$kq=mysql_query($sql);
		echo "<script>alert('Quý khách đã thay đổi thông tin cá nhân thành công! ');window.location='index.php?b=ttcn';</script>";
	}
	else
		echo "<script>alert('Quý khách đã thay đổi thông tin cá nhân KHÔNG thành công! ');window.location='index.php?b=ttcn';</script>";
	}
?>

<?php
$email=$_REQUEST["email"];
$sql="select * from khachhang where email='$email'";
$kq=mysql_query($sql);
$r=mysql_fetch_array($kq);
$hoten=$r["tenkh"];$email=$r["email"];$diachi=$r["diachi"];$dienthoai=$r["sdtban"];$dt=$r["sdtdd"];
?>

<form method="post" action="index.php" id="ddd">
<input type="hidden" name="action" value="change" />
        <table width="700px" cellspacing="0" cellpadding="0" bordercolordark="#FFFFFF" style="border:1px solid #CCC;margin:0 auto 0 20px;">
          <tr>
            <td height="35" colspan="2" align="center">THAY ĐỔI THÔNG TIN CÁ NHÂN - <?php echo "$hoten"; ?></td>
          </tr>	  
          <tr onmouseover="style.background='#c8dbf0'" onmouseout="style.background='#FFFFFF'">            
            <td height="30px" width="100px"style="padding-left:70px">Họ tên:</td>
     		<td style="padding-left:15px;">
       		
       		    <input type="text" name="hoten" style="width:220px" value="<?php echo "$hoten"; ?>" class="required"/>
   		     </td>            
          </tr>
          <tr onmouseover="style.background='#c8dbf0'" onmouseout="style.background='#FFFFFF'">   
            <td height="30" width="100px" style="padding-left:70px">Địa chỉ:</td>
 			<td style="padding-left:15px" valign="top" align="left">              
                <textarea name="diachi" rows="6" style="width:220px"  class="required"><?php echo "$diachi"; ?></textarea>
             </td>            
          </tr>       
          <tr bgcolor="#f9f9f9" onmouseover="style.background='#c8dbf0'" onmouseout="style.background='#F9F9F9'">            
            <td height="30" width="100px" style="padding-left:70px">Điện thoại bàn:</td>
 			<td style="padding-left:15px">
                <input type="text" name="dienthoai" style="width:220px" value="<?php echo "$dienthoai"; ?>" class="required" minlength=7 maxlength=11/>
             </td>            
          </tr>
           <tr bgcolor="#f9f9f9" onmouseover="style.background='#c8dbf0'" onmouseout="style.background='#F9F9F9'">            
            <td height="30" width="100px" style="padding-left:70px">Điện thoại di động:</td>
 			<td style="padding-left:15px">
                <input type="text" name="dt" style="width:220px" value="<?php echo "$dt"; ?>" class="required" minlength=10 maxlength=15/>
            </td>            
          </tr>
          <tr>
            <td height="35" colspan="2" bgcolor="#2d94ff">
                <input type="submit" name="submit" value="Sửa"  style="height:30px; width:70px; margin-left:210px;">
	<input type="reset" value="Nhập lại"  style="height:30px; width:70px;" >	
            </td>
          </tr>
        </table>
</form>
